home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / initAttributeEditor.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  5.4 KB  |  190 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  24 November 1998
  22. //
  23. //  Description:
  24. //      This script initializes the Attribute Editor.  
  25. //
  26.  
  27. global proc showAttributeEditor(int $show)
  28. //
  29. //    Description:
  30. //
  31. //        *** Obsolete ***
  32. //
  33. //        *** Use runTimeCommand ToggleAttributeEditor instead ***
  34. //    
  35. //    Arguments:
  36. //        show - True if the Attribute Editor should be shown, false if the 
  37. //               Attribute Editor should become hidden.
  38. //
  39. {
  40.     warning -showLineNumber true
  41.         ("The procedure \"showAttributeEditor()\" is now obsolete. "
  42.         + "Use the command \"ToggleAttributeEditor\" instead.");
  43. }
  44.  
  45. global proc int attributeEditorVisibilityStateChange(
  46.     int    $newState,
  47.     string $layout)
  48. //
  49. //    Description:
  50. //        This procedure is called whenever the visibility state of the 
  51. //        Attribute Editor is changed.
  52. //
  53. //    Arguments:
  54. //        newState - The new visibile state of the Attribute Editor.
  55. //
  56. //        layout - The parent layout for the Attribute Editor.
  57. //
  58. //    Returns:
  59. //        true - If the change of state is to be allowed.
  60. //
  61. //        false - If the state change is rejected.
  62. //
  63. {
  64.     global string $gAttributeEditorForm;
  65.     global int    $gAutoUpdateAttrEdFlag;
  66.     global int    $gIgnoreAEUpdate;
  67.  
  68.     string $children[], $attributeEditorForm;
  69.     int    $count = `layout -query -numberOfChildren $gAttributeEditorForm`;
  70.     int    $result = true;
  71.  
  72.     if ($newState) {
  73.         //
  74.         //    Delete the Attribute Editor window if necessary.
  75.         //
  76.         if (`window -exists AEWindow`) {
  77.             deleteUI -window AEWindow;
  78.         }
  79.  
  80.         if (0 == $count) {
  81.             //
  82.             //    Need to create the Attribute Editor controls.
  83.             //
  84.             $attributeEditorForm = `formLayout 
  85.                 -parent $gAttributeEditorForm
  86.                 `;
  87.             createAEWindowContents $attributeEditorForm "" auto;
  88.  
  89.             //    Get the child of the formLayout, and perform the
  90.             //    appropriate attachments for the AE formLayout.
  91.             //
  92.             $children = `formLayout -query -childArray 
  93.                 $attributeEditorForm`;
  94.  
  95.             formLayout -edit
  96.                 -attachForm $children[0] "top"    0
  97.                 -attachForm $children[0] "left"   0
  98.                 -attachForm $children[0] "bottom" 0
  99.                 -attachForm $children[0] "right"  0
  100.                 $attributeEditorForm;
  101.  
  102.             //    Attach Attribute Editor to parent.
  103.             //
  104.             formLayout -edit
  105.                 -attachForm $attributeEditorForm "top"    0
  106.                 -attachForm $attributeEditorForm "left"   0
  107.                 -attachForm $attributeEditorForm "bottom" 0
  108.                 -attachForm $attributeEditorForm "right"  0
  109.                 $gAttributeEditorForm;
  110.  
  111.             //    Force a refresh with the lead object
  112.             //
  113.             string $selected[] = `ls -selection -tail 1`;
  114.             updateAE $selected[0];
  115.         }
  116.  
  117.         // if the AE is in auto mode, update it.
  118.         //
  119.         if ($gAutoUpdateAttrEdFlag && !$gIgnoreAEUpdate) {
  120.             evalDeferred("autoUpdateAttrEd");
  121.         }
  122.         $result = true;
  123.  
  124.     } else {
  125.         $result = true;
  126.     }
  127.  
  128.     //    Defer these commands because this proc is called when the visibility
  129.     //    state is about to change. This proc must return true to accept 
  130.     //    the state change. After this proc returns then restore the
  131.     //    panel focus and update the pref menu.
  132.     //
  133.     evalDeferred("restoreLastPanelWithFocus();updatePrefsMenu();");
  134.  
  135.     return $result;
  136. }
  137.  
  138. {
  139.     source showEditor;
  140.  
  141.     //    Declare referenced or returned variables
  142.     //
  143.     global string $gAttributeEditorForm;
  144.  
  145.     //    Determine values of option variables
  146.  
  147.     int $attributeEditorVisible = `optionVar -query isAttributeEditorVisible`;
  148.  
  149.     //  Create a layout appropriate for the Attribute Editor.
  150.     //
  151.     string $attributeEditorForm = `formLayout -parent $gAttributeEditorForm`;
  152.  
  153.     //    Create the contents of the Attribute Editor.
  154.     //
  155.     createAEWindowContents $attributeEditorForm "" auto;
  156.  
  157.     //    Get the child of the formLayout, and perform the
  158.     //    appropriate attachments for the AE formLayout
  159.     //
  160.     string $children[] = `formLayout -query -childArray $attributeEditorForm`;
  161.  
  162.     formLayout -edit
  163.         -attachForm $children[0] "top"    0
  164.         -attachForm $children[0] "left"   0
  165.         -attachForm $children[0] "bottom" 0
  166.         -attachForm $children[0] "right"  0
  167.         $attributeEditorForm;
  168.  
  169.     //    Attach Attribute Editor to parent.
  170.     //
  171.     int $offset = 3;
  172.     if (`about -mac`) {
  173.         $offset = 3;
  174.     }
  175.     formLayout -edit
  176.         -attachForm $attributeEditorForm "top"    $offset  // to make the menus line up
  177.         -attachForm $attributeEditorForm "left"   0
  178.         -attachForm $attributeEditorForm "bottom" 0
  179.         -attachForm $attributeEditorForm "right"  0
  180.         $gAttributeEditorForm;
  181.  
  182.     setUIComponentStateCallback(
  183.         "Attribute Editor", "attributeEditorVisibilityStateChange");
  184.     
  185.     //    Set the visibility of the Attribute Editor.
  186.     //
  187.     setAttributeEditorVisible($attributeEditorVisible);
  188. }
  189.  
  190.